#include "stdio.h"
#include "unistd.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>

#include     <stdio.h>     
#include     <fcntl.h>    
#include     <termios.h>   

#define DPR_WDG_MAGIC 'u'
#define DPR_WDG_TURN_ON_LED 				_IOW(DPR_WDG_MAGIC, 0,int)
#define DPR_WDG_TURN_OFF_LED 				_IOW(DPR_WDG_MAGIC, 1,int)
#define DPR_WDG_CLEAR 					_IOW(DPR_WDG_MAGIC, 2,int)
#define DPR_WDG_RESET_COUNT 				_IOR(DPR_WDG_MAGIC, 3,int)
#define DPR_WDG_ENABLE					_IOW(DPR_WDG_MAGIC, 4,int)
#ifdef WDG_TIMEOUT_DEBUG
#define DPR_WDG_RD_TIMEOUT_STATUS 			_IOR(DPR_WDG_MAGIC, 5,int)
#define DPR_WDG_CLR_TIMEOUT_STATUS			_IOW(DPR_WDG_MAGIC, 6,int)
#define DPR_WDG_START_TIMEOUT_CHK			_IOW(DPR_WDG_MAGIC, 7,int)
#define DPR_WDG_RD_KICK_INT 				_IOR(DPR_WDG_MAGIC, 8,int)
#endif
#define DPR_WDG_RD_AD_VALUE 				_IOR(DPR_WDG_MAGIC, 9,int)
#define DPR_WDG_RD_GPIO_INPUT0_VALUE			_IOR(DPR_WDG_MAGIC, 10,int)
#define DPR_WDG_RD_GPIO_INPUT1_VALUE			_IOR(DPR_WDG_MAGIC, 11,int)
int led_sn[]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27};

main()
{
int val;
int fd;
int i;
	fd=open("/dev/dpr_wdg",O_RDWR);
	ioctl(fd,DPR_WDG_RD_GPIO_INPUT0_VALUE,&val);
	printf("gpio_input_0 = %d \n",val);
	ioctl(fd,DPR_WDG_RD_GPIO_INPUT1_VALUE,&val);
	printf("gpio_input_1 = %d \n",val);
	for(i=0;i<24;i++)
	{
		ioctl(fd,DPR_WDG_TURN_ON_LED,&(led_sn[i]));
		sleep(1);
		ioctl(fd,DPR_WDG_TURN_OFF_LED,&(led_sn[i]));
		sleep(1);
	}
	close(fd);	
}
